import type {ExtractPropTypes, PropType} from "vue";

export type SearchFromOptionColumn = {
  label: string;
  value: string;
}

export type SearchFromItem = {
  type: "input" | "date" | "select";
  label: string;
  model: string;
  default?: string | Date;
  options?: SearchFromOptionColumn[];
  placeholder?: string;
}

export const searchProps = {
  form: {
    type: Array as PropType<SearchFromItem[]>,
    required: true,
    default: () => []
  },
  searchText: {
    type: String,
    default: "搜索"
  },
  searchType: {
    type: String as PropType<"" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text">,
    default: "primary"
  },
  cancelText: {
    type: String,
    default: "重置"
  },
  cancelType: {
    type: String as PropType<"" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text">,
    default: ""
  }
};

export type SearchProps = ExtractPropTypes<typeof searchProps>;
